package com.itheima.service.Impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.mapper.OperateLogMapper;
import com.itheima.pojo.OperateLog;
import com.itheima.pojo.PageBean;
import com.itheima.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LogServiceImpl implements LogService {
    @Autowired
    private OperateLogMapper operateLogMapper;

    /**
     * 分页查询日志
     *
     * @param page 起始索引
     * @param pageSize  分页大小
     */
    @Override
    public PageBean selectPage(Integer page, Integer pageSize) {
        PageHelper.startPage(page, pageSize);

        Page<OperateLog> logPage =operateLogMapper.selectPage();

        return new PageBean(logPage.getTotal(),logPage.getResult());
    }
}
